{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: save_file_no_output"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["import random\n", "import string\n", "import gradio as gr \n", "\n", "def save_image_random_name(image):\n", "    random_string = ''.join(random.choices(string.ascii_letters, k=20)) + '.png'\n", "    image.save(random_string)\n", "    print(f\"Saved image to {random_string}!\")\n", "\n", "demo = gr.Interface(\n", "    fn=save_image_random_name, \n", "    inputs=gr.Image(type=\"pil\"), \n", "    outputs=None,\n", ")\n", "if __name__ == \"__main__\":\n", "    demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}